package pages

import (
	"github.com/templui/templui/internal/ui/layouts"
	"github.com/templui/templui/internal/ui/modules"
	"github.com/templui/templui/internal/ui/showcase"
)

templ Skeleton() {
	@layouts.DocsLayout(
		"Skeleton",
		"UI placeholder for indicating content that is loading.",
		[]modules.TableOfContentsItem{
			{
				ID:   "installation",
				Text: "Installation",
			},
			{
				Text: "Examples",
				ID:   "examples",
				Children: []modules.TableOfContentsItem{
					{
						Text: "Profile",
						ID:   "profile",
					},
					{
						Text: "Card",
						ID:   "card",
					},
					{
						Text: "Dashboard",
						ID:   "dashboard",
					},
				},
			},
			{
				ID:   "api",
				Text: "API Reference",
				Children: []modules.TableOfContentsItem{
					{
						ID:   "skeleton",
						Text: "Skeleton",
					},
				},
			},
		},
	) {
		@modules.PageWrapper(modules.PageWrapperProps{
			Name:        "Skeleton",
			Description: templ.Raw("UI placeholder for indicating content that is loading. It's designed to be a simple building block that users can compose into more complex loading UI patterns."),
			Tailwind:    true,
			Breadcrumbs: modules.Breadcrumbs{
				Items: []modules.BreadcrumbItem{
					{
						Text: "Docs",
						Path: "/docs",
					},
					{
						Text: "Components",
						Path: "/docs/components",
					},
					{
						Text: "Skeleton",
					},
				},
			},
		}) {
			@modules.ExampleWrapper(modules.ExampleWrapperProps{
				ShowcaseFile:    showcase.SkeletonDefault(),
				PreviewCodeFile: "skeleton_default.templ",
			})
			@modules.ContainerWrapper(modules.ContainerWrapperProps{
				Title: "Installation",
				ID:    "installation",
			}) {
				@modules.ComponentUsage(modules.ComponentUsageProps{
					ComponentName: "skeleton",
				})
			}
			@modules.ContainerWrapper(modules.ContainerWrapperProps{
				Title: "Examples",
				ID:    "examples",
			}) {
				@modules.ExampleWrapper(modules.ExampleWrapperProps{
					SectionName:     "Profile",
					ShowcaseFile:    showcase.SkeletonProfile(),
					PreviewCodeFile: "skeleton_profile.templ",
					ID:              "profile",
				})
				@modules.ExampleWrapper(modules.ExampleWrapperProps{
					SectionName:     "Card",
					ShowcaseFile:    showcase.SkeletonCard(),
					PreviewCodeFile: "skeleton_card.templ",
					ID:              "card",
				})
				@modules.ExampleWrapper(modules.ExampleWrapperProps{
					SectionName:     "Dashboard",
					ShowcaseFile:    showcase.SkeletonDashboard(),
					PreviewCodeFile: "skeleton_dashboard.templ",
					ID:              "dashboard",
				})
			}
			@modules.ContainerWrapper(modules.ContainerWrapperProps{
				Title: "API Reference",
				ID:    "api",
			}) {
				@modules.APILegend()
				<div id="skeleton" class="mb-8">
					@modules.APITable(modules.APITableProps{
						Title:       "Skeleton",
						Description: "Loading placeholder component that can be composed into complex loading UI patterns.",
						Items: []modules.APITableItem{
							{
								Name:        "ID",
								Type:        "string",
								Default:     "",
								Description: "Unique identifier for the skeleton element.",
								Required:    false,
							},
							{
								Name:        "Class",
								Type:        "string",
								Default:     "",
								Description: "Additional CSS classes to apply to the skeleton.",
								Required:    false,
							},
							{
								Name:        "Attributes",
								Type:        "templ.Attributes",
								Default:     "",
								Description: "Additional HTML attributes to apply to the skeleton element.",
								Required:    false,
							},
						},
					})
				</div>
			}
		}
	}
}
